/*************************************************
 * 
 * Copyright by Bruno Eberhard
 * 
 * Created on 31.07.2005
 *
 *************************************************/
package fightplan.views;

import java.awt.BorderLayout;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;

import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.JPanel;

import com.jgoodies.binding.value.ValueModel;

import fightplan.business.Sheet;

@SuppressWarnings("serial")
public class ClientPanel extends JPanel implements PropertyChangeListener {
	private ValueModel sheetModel;

	public ClientPanel(ValueModel sheetModel) {
		setLayout(new BorderLayout());
		setBorder(BorderFactory.createEmptyBorder(8, 15, 8, 15));
		this.sheetModel = sheetModel;
		sheetModel.addValueChangeListener(this);

	}

	public void propertyChange(PropertyChangeEvent evt) {
		Sheet sheet = (Sheet) sheetModel.getValue();
		this.removeAll();
		JLabel label = new JLabel();
		label.setFont(getFont().deriveFont(18F));
		label.setText("Kategorie: " + sheet.category.getName() + " / Seite: " + (sheet.sheetNo + 1));
		this.add(label, BorderLayout.NORTH);
		this.add(sheet.category.getLayout().getSheetComponent(sheet.sheetNo), BorderLayout.CENTER);
		this.revalidate();
	}

}